package com.ruoyi.aitapp.vo;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import lombok.Data;

@Data
public class LicenseInfoVO {
    private String cpuid;
    private String startDate;
    private String endDate;
    private int maxUserNum=0;
    private int curUserNum=0;
    private int usableUserNum=0;
    private int usableDateNum=0;

    public LicenseInfoVO() {
    }

    public int getUsableUserNum() {
        return maxUserNum-curUserNum;
    }

    public int getUsableDateNum() {
        final DateTime curTime = DateUtil.date();
        final DateTime endTime = DateUtil.parseDate(endDate);
        return (int) DateUtil.between(curTime,endTime,DateUnit.DAY,false);
    }
}
